package learn_design_patterns.c2.weather;

import java.util.Observable;

public class WeatherData extends Observable {
	// private List<Observer> observers = new ArrayList<>();

	private float temperature;
	private float humidity;
	private float pressure;

	// @Override
	// public void registerObserver(Observer o) {
	// observers.add(o);
	// }
	//
	// @Override
	// public void removeObserver(Observer o) {
	// observers.remove(o);
	// }

	// @Override
	// public void notifyObservers() {
	// for (Observer o : observers) {
	// o.update(temperature, humidity, pressure);
	// }
	// }

	public void measurementsChanged() {
		setChanged();
		notifyObservers();
	}

	public void setMeasurements(float temp, float humidity, float pressure) {
		this.temperature = temp;
		this.humidity = humidity;
		this.pressure = pressure;
		measurementsChanged();
	}

	public float getTemperature() {
		return temperature;
	}

	public float getHumidity() {
		return humidity;
	}

	public float getPressure() {
		return pressure;
	}

}
